import Vue from 'vue'
import VueRouter from "vue-router";
 
Vue.use(VueRouter)



import Article from '@/views/Article.vue'
import Collect from '@/views/Collect.vue'
import Like from '@/views/Like.vue'
import User from '@/views/User.vue'
import Layout from '@/views/Layout.vue'
// import { component } from 'vue/types/umd';
import ArticleDetail from '@/views/ArticleDetail.vue'


const router = new VueRouter({
  routes: [
    //跳转到新页面，是一级路由
    {
  path: '/detail/:id',
    component: ArticleDetail
    },
    {
      path: '/',
      // 默认选中面经页面
      redirect: '/home/article'
    },
    {
      path: '/home',
      component: Layout,
      // 在home页面中部分更新，所以这四个是二级路由
      children:[
        {
          path:'article',
          component:Article,
        },
        {
          path:'collect',
          component:Collect
        },
        {
          path:'like',
          component:Like
        },
        {
          path:'user',
          component:User
        }
      ]
    },
    
  ]
})

export default router